{extend name="admin/base" /}
{block name="resources"/}
<style>
.mytable {border: 0;}
.style0list tbody td {vertical-align: middle;}
.style0list  tbody tr {border-bottom: 1px dashed  #E3E3E3;}
a{
	cursor:pointer;
}
</style>
{/block}
{block name="main"}
<div class="mod-table">
	<div class="mod-table-head">
		<table class="mytable">
			<tr>
				<th width="10%">
					<input type="text" id='search_text' placeholder="请输入粉丝名称" />
					<input type="button" onclick="searchData()" value="搜索" />
				</th>
			</tr>
		</table>
		<div class="style0list">
			<table>
				<thead>
					<tr align="center">
						<th><label style="margin-left: 5px;"><input type="checkbox" onclick="CheckAll(this)"></label></th>
						<th>粉丝头像</th>
						<th class="tal">粉丝名称</th>
						<th class="tal">地址</th>
						<th>关注状态</th>
						<th>关注时间</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
		</div>
	</div>
</div>
{/block}
{block name="script"}

<script type="text/javascript">
	function LoadingInfo(page_index) {
		var search_text = $("#search_text").val();
		$.ajax({
			type : "post",
			url : "{:__URL('ADMIN_MAIN/member/weixinfanslist')}",
			async : true,
			data : {
				"page_index" : page_index, "page_size" : $("#showNumber").val(), "search_text" : search_text
			},
			success : function(data) {
				var html = '';
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						var is_subscribe = "";
						var sex = "";
						if(data["data"][i]["is_subscribe"] == 1){
							is_subscribe = "已关注";
						}else{
							is_subscribe = "取消关注";
						}
						if(data["data"][i]["sex"] == 1){
							sex = '男';
						}else{
							sex = '女';
						}
						var country = "";
						var province = "";
						var city = "";
						var district = "";
						if(data["data"][i]["country"] != "无"){
							country = data["data"][i]["country"];
						}
						if(data["data"][i]["province"] != "无"){
							province = data["data"][i]["province"];
						}
						if(data["data"][i]["city"] != "无"){
							city = data["data"][i]["city"];
						}
						if(data["data"][i]["district"] != "无"){
							district = data["data"][i]["district"];
						}
						
						html += '<tr align="center">';
						html += '<td><div class="cell"><label ><input name="sub" type="checkbox" value="'+ data["data"][i]["fans_id"]+'" ></label></div></td>';
						//html += '<td>' + data["data"][i]["uid"]+ '</td>';
						html += '<td>';
						if(data["data"][i]["headimgurl"] ==""){
							html += '<img src="__STATIC__/images/default_user_portrait.gif" class="head-portrait" />';							
						}else{
							html += '<img src="'+data["data"][i]["headimgurl"]+'" class="head-portrait" />';
						}
						html += '</td>';
						if (data["data"][i]["nickname_decode"] == null || "" == data["data"][i]["nickname_decode"]) {
							html += '<td class="tal">--</td>';
						} else {
							html += '<td class="tal">' + data["data"][i]["nickname_decode"] + '</td>';
						}

						html += '<td class="tal">' + country +province +city+district +'</td>';
						
						html += '<td>' + is_subscribe + '</td>';
						html += '<td>' + timeStampTurnTime(data["data"][i]["subscribe_date"]) + '</td>';
						html += '<td>' + data["data"][i]["memo"] + '</td>';
						
						
						html += '</tr>';
					}
				} else {
					html += '<tr align="center"><th colspan="9">暂无符合条件的数据记录</th></tr>';
				}
				$(".style0list tbody").html(html);
				initPageData(data["page_count"],data['data'].length,data['total_count']);
				$("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
			}
		});
	}
	//全选
	function CheckAll(event){
		var checked = event.checked;
		$(".style0list tbody input[type = 'checkbox']").prop("checked",checked);
	}

	function searchData(){
		LoadingInfo(1);
	}
	
</script>
{/block}